// pages/subject/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    length:0,
    value:""
  },
  descInput: function (e) {
    console.log(e)
    this.setData({
      length: e.detail.cursor,
      value: e.detail.value
    })
    },
  on(e){
    let that = this
    let url = wx.getStorageSync('url');
    let authorization = wx.getStorageSync('authorization');
    if(that.data.value == ''){
      wx.showModal({
        title: '提示',
        content: '请输入建议',
        success: function (res) {
          if (res.confirm) {
            console.log('用户点击确定')

          } else if (res.cancel) {
            console.log('用户点击取消')
          }
        }
      })
    }else{
    wx.request({
      url: url + "/v1/company/proposal_evaluate",
      data: {
        content:that.data.value
      },
      method: "post",
      header: {
        'content-type': 'application/json',
        'authorization': authorization,
        'openid': wx.getStorageSync('openid')
      },
      success: function (res) {
        wx.showToast({
          title: "感谢反馈",
          icon: 'success',
          duration: 1000
        })
        that.setData({
          value:'',
          length:0
        })
      }
    })
  }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },

  

})